syntax error near unexpected token `('

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nvr
    New Member
    • Mar 2008
    • 3

    syntax error near unexpected token `('

    hi all

    i am getting the error

    line 11: syntax error near unexpected token `('
    line 11: `int main()'


    while trying to complie a c program in ubuntu
    The code is very simple
    # include <stdio.h>

    int main()
    {
    printf("Hello") ;
    return 0;
    }

    Please help me how to rectify this

    Vani
  • oberon
    New Member
    • Mar 2008
    • 14

    #2
    The code you gave compiles fine on my system. How do you invoke the compiler? gcc <filename>?

    Comment

    • kaarthikeyapreyan
      New Member
      • Apr 2007
      • 106

      #3
      Originally posted by nvr
      hi all

      i am getting the error

      line 11: syntax error near unexpected token `('
      line 11: `int main()'


      while trying to complie a c program in ubuntu
      The code is very simple
      # include <stdio.h>

      int main()
      {
      printf("Hello") ;
      return 0;
      }

      Please help me how to rectify this

      Vani
      It works good for me too
      Am using gcc 4.1.0
      and the steps
      test.c(your code)
      Code:
      gcc test.c -o test
      ./test
      and it print hello

      I dont believe its your compiler's problem

      Comment

      Working...